﻿@using XiaoYuStock.Model
@using XiaoYuStock.Model.Models
@using XiaoYuStock.Model.Request
@using XiaoYuStock.WebApp.Controls
@model PagedList<XiaoYuStock.Model.Entities.AnalysisDataModel>
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="row-fluid">
    <div class="span10">
@using (Html.BeginForm(null, null, null, FormMethod.Get, new { id = "search", @class = "form-inline" }))
        {
        <div class="dataTables_filter">
            <label><button type="submit" class="btn" id="btnSearch">查询 <i class="icon-search"></i></button></label>
            <label>
                <span>日期：</span>
                @Html.TextBox("BeginDate", null, new { @class = "m-wrap small" })--@Html.TextBox("EndDate", null, new { @class = "m-wrap small" })
            </label>
            <label>
                <span>股票：</span>
                @Html.TextBox("ShareCode", null, new { @class = "m-wrap small"})
            </label>
            <label>
                <span>模式：</span>
                @Html.DropDownList("AnalysedType")
            </label>
        </div>
}
    </div>
</div>

    <table class="table table-striped table-hover " id="tableHistory">
        <thead>
            <tr>
                <th>
                    项目
                </th>
                <th>
                    分析日期
                </th>
                <th>分析类型</th>
                <th>天数</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var p in Model)
            {
                <tr>
                    <td class="blue">
                        <a target="_blank" href="@Url.Action("Index", "HistoryData", new
                            {
                                ShareCode = @p.ShareCode
                            })"><span title="@p.ShareCode"> @p.ShareCode</span>【@p.ShareName】</a>
                        </td>
                    <td>@p.AnalysisDate.ToString("yyyy-MM-dd")</td>
                    <td>@p.AnalysisType</td>
                    <td>@p.Days</td>
                    </tr>
            }
        </tbody>
    </table>
<div class="dataTables_paginate paging_bootstrap pagination">
    @Html.Pager(Model, new PagerOptions() { ShowTotalItemCount = true, AutoHide = false })
</div>
<script>
    var dates = $("#BeginDate, #EndDate").datepicker({
        dateFormat: "yy-mm-dd",
        defaultDate: "+0",
        changeMonth: true,
        changeYear: true,
        numberOfMonths: 1,
        onSelect: function (selectedDate) {
            var option = this.id == "startDate" ? "minDate" : "maxDate",
            instance = $(this).data("datepicker"),
            date = $.datepicker.parseDate(
                instance.settings.dateFormat ||
                $.datepicker._defaults.dateFormat,
                selectedDate, instance.settings);
            dates.not(this).datepicker("option", option, date);
        }
    });

</script>


